/*
 * NodeFactory.h
 *
 *  Created on: 2010-6-3
 *      Author: Guobc
 */

#ifndef NODEFACTORY_H_
#define NODEFACTORY_H_

#include <map>
#include "dom_ast_inc.h"
#include "ElementInc.h"

using namespace std;

namespace HA {
/**
 * Node factory responsible for data creating.
 */
class NodeFactory {

public:

	NodeFactory();

	~NodeFactory();

	/**
	 * Create a text node.
	 * @param document A ASTDom.
	 * @param start The start position.
	 * @param end The end position.
	 */
	Text* createStringNode(ASTDom* document, int start, int end);

	/**
	 * Create a comment node.
	 * @param document A ASTDom.
	 * @param start The start position.
	 * @param end The end position.
	 */
	Comment* createCommentNode(ASTDom* document, int start, int end);

	/**
	 * Create a element node.
	 * @param document A ASTDom.
	 * @param start The start position.
	 * @param end The end position.
	 */
	Element* createElementNode(ASTDom* document, int start, int end, const string& Id);

	/**
	 * Register all known elements to the map.
	 */
	void registerElements();

	/**
	 * Register a known element to the map.
	 */
	void registerElement(Element* element);

private:
	map<string, Element*> elements;
};
}

#endif /* NODEFACTORY_H_ */
